﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="APIDetail.aspx.cs" Inherits="Web.APIDetail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:FormView runat="server" DataSourceID="SqlDataSourceAPIDetail">
            <ItemTemplate>
                名称：<asp:TextBox ID="TxtName" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox><br />
                描述：<asp:TextBox ID="TxtDescription" runat="server" Text='<%# Eval("Description") %>'></asp:TextBox><br />
                返回格式:<asp:TextBox ID="TxtResponseFormat" runat="server" Text='<%# Eval("ResponseFormatID") %>'></asp:TextBox><br />
                请求方式:<asp:RadioButton ID="RdbtnGET" runat="server" Text="GET" /><asp:RadioButton
                    ID="RdbtnPOST" runat="server" Text="POST" /><br />
                <asp:CheckBox ID="CbNeedLogin" runat="server" Text="是否需要登录" Checked='<%# Eval("NeedLogin") %>' /><br />
                备注:<asp:TextBox ID="TxtAddition" runat="server" Text='<%# Eval("Addition") %>'></asp:TextBox><br />
                修改时间:<asp:Label ID="TxtModifyDate" runat="server" Text='<%# Eval("ModifyDate") %>'></asp:Label>
            </ItemTemplate>
        </asp:FormView>
        <div>
            <h2>
                请求参数列表</h2>
            <a href='AddRequestParamter.aspx?ID=<%=Request.QueryString["ID"] %>'>添加请求参数</a>  
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                DataSourceID="SqlDataSourceParameterRequestList">
                <Columns>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    <asp:CheckBoxField DataField="Required" HeaderText="Required" SortExpression="Required" />
                    <asp:BoundField DataField="Range" HeaderText="Range" SortExpression="Range" />
                    <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                    <asp:BoundField DataField="Default" HeaderText="Default" SortExpression="Default" />
                </Columns>
            </asp:GridView>
        </div>
        
        <div>
            <h2>返回参数列表</h2>
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="ID" DataSourceID="SqlDataSourceParameterResponseList">
                <Columns>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    <asp:BoundField DataField="Description" HeaderText="Description" 
                        SortExpression="Description" />
                    <asp:BoundField DataField="ParameterTypeID" HeaderText="ParameterTypeID" 
                        SortExpression="ParameterTypeID" />
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSourceParameterResponseList" runat="server" 
                ConnectionString="<%$ ConnectionStrings:OnlineAPIConnectionString %>" 
                SelectCommand="SELECT [ID], [Name], [Description], [ParameterTypeID] FROM [ResponseParamter] WHERE ([APIID] = @APIID)">
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="0" Name="APIID" QueryStringField="ID" 
                        Type="Int64" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </div>
    <asp:SqlDataSource ID="SqlDataSourceAPIDetail" runat="server" ConnectionString="<%$ ConnectionStrings:OnlineAPIConnectionString %>"
        SelectCommand="SELECT * FROM [API] WHERE ([ID] = @ID)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="ID" QueryStringField="ID" Type="Int64" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceParameterRequestList" runat="server" ConnectionString="<%$ ConnectionStrings:OnlineAPIConnectionString %>"
        SelectCommand="SELECT [Name], [Required], [Range], [Description], [Default], [ID] FROM [RequestParameter] WHERE ([APIID] = @APIID)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="APIID" QueryStringField="ID" Type="Int64" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
